﻿//using System;
//using System.Collections.Generic;
//using Brouteforce.managers;
//using Brouteforce.utilities;
//using Microsoft.Xna.Framework;

//namespace Brouteforce.gameObjs.gamePiece {

//    public class Shooter : GamePiece {
//        public const double MinShootChances = 0.5;
//        public const double MaxShootChances = 1;
//        public const double OutOfSightChances = 0.05;
        

//        public bool IsShooting = false;
//        private List<Location> _shots = new List<Location>();

//        public Shooter(int speed, int light, int life, int power, Tile initialTile, int belongsToPlayer)
//            : base(
//                speed, light, life, power, new Sprite(BFGame.TileShooter, initialTile.Sprite.Location.Position),
//                belongsToPlayer)
//        {
//            ShotsLeft = ShotsPerTurn;
//        }

//        public override void MousePassedOnTile(Tile tile)
//        {
//            DashbordMsg = "The HitChances are : " + HitChances(tile, WorldManager.GetGamePieceTileInWorld(this));
//            //DashboardManager.DisplayMsgMousePassedOnTile(HitChances(tile, WorldManager.GetGamePieceTileInWorld(this)));
//        }


//        public override void Fire(Tile fromTile, Tile toTile) {
//            if (ShotsLeft == 0) return;
//            IsShooting = true;
//            Location shot = new Location(Location.Position.Center.X, Location.Position.Center.Y, 1,1);
//            var waypoint = toTile.Sprite.Location.Position.Center;
//            shot.SetWaypoint(new Vector2(waypoint.X, waypoint.Y), 150);
//            _shots.Add(shot);
//            ShotsLeft = ShotsPerTurn - 1;
//            GamePiece opponentGamePiece = WorldManager.GetOpponentGamePieceFromTile(toTile);
//            if (opponentGamePiece == null) return;
//            double chance = ComputeChances(toTile, fromTile);
//            if (Randoms.IsLucky(chance))
//                PlayersManager.DecreaseLife(opponentGamePiece, Power);

//        }
        
//        protected override void InnerUpdate() {
//            if (IsShooting){
//                if (_shots.Count == 0)
//                    IsShooting = false;
//                else{
//                    _shots.ForEach(shot => shot.LinearMove());
//                    _shots.RemoveAll(shot => shot.IsReachedWaypoint());
//                }
//            }
//        }


//        public override void Draw(int x, int y) {
//            Sprite.Draw(x, y);

//            if (IsShooting){
//                foreach (var l in _shots){
//                    var lineSegment = Geometrics.GetLineSegment(Geometrics.ShiftLine(l.AirlineToWaypoint,-x,-y), 0, 10);
//                    //DashboardManager.DisplayMsgMousePassedOnTile("segment: " + lineSegment.X + ", " + lineSegment.Y + " => " + lineSegment.Z + ", " + lineSegment.W);
//                    Draws.DrawLine(lineSegment, Color.Yellow, 2);
//                }
//            }
//        }
//    }
//}